//
//  UIBarButtonItem+CHYExtension.m
//  百思不得姐
//
//  Created by 崔 on 16/7/22.
//  Copyright © 2016年 崔. All rights reserved.
//

#import "UIBarButtonItem+CHYExtension.h"

@implementation UIBarButtonItem (CHYExtension)
+(instancetype)itemWithNormalImage:(NSString *)normalImage highImage:(NSString *)highImage target:(id)target action:(SEL)action andBtnOffset:(UIEdgeInsets)offSet{
    
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [btn setImage:[UIImage imageNamed:normalImage] forState:UIControlStateNormal];
    
    [btn setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
    
    [btn sizeToFit];
    //左移一点
    [btn setContentEdgeInsets:offSet];
    
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[self alloc] initWithCustomView:btn];
    
}
@end
